<template>
    <el-dialog v-model="show" title="部件入库" width="40%" align-center @close="handleClose">
        <el-descriptions :column="4">
            <el-descriptions-item label="半成品名称：">CAKE半成品</el-descriptions-item>
            <el-descriptions-item label="入库仓库名称：">宋广才库</el-descriptions-item>
            <el-descriptions-item label="申情生产数量：">1000</el-descriptions-item>
            <el-descriptions-item label="总生产数量：">1000</el-descriptions-item>
        </el-descriptions>

        <el-table :data="tableData" style="width: 100%">
            <el-table-column prop="date" label="部件名称" />
            <el-table-column prop=" name" label="计划数量" />
            <el-table-column prop="address" label="入库数量" />
        </el-table>

        <div class="mt20" style="display: flex; align-items: center; justify-content: flex-end;">
            <el-checkbox label="此工序完结" />
        </div>


        <template #footer>
            <div class="dialog-footer">
                <el-button @click="handleClose">取 消</el-button>
                <el-button type="primary" @click="handleSubmit()">确 定</el-button>
            </div>
        </template>
    </el-dialog>
</template>

<script setup lang="ts">
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const props = defineProps(['visible', 'initList']);
const emits = defineEmits(['submit', 'close']);

const show = ref(false);

watch(() => props.visible, async (newValue) => {
    show.value = newValue
    if (newValue) {
    }
}, { deep: true });

const tableData = [
    {
        date: '2016-05-03',
        name: 'Tom',
        address: 'No. 189, Grove St, Los Angeles',
    },
    {
        date: '2016-05-02',
        name: 'Tom',
        address: 'No. 189, Grove St, Los Angeles',
    },
    {
        date: '2016-05-04',
        name: 'Tom',
        address: 'No. 189, Grove St, Los Angeles',
    },
    {
        date: '2016-05-01',
        name: 'Tom',
        address: 'No. 189, Grove St, Los Angeles',
    },
]


const handleSubmit = async () => {
    proxy?.$modal.msgSuccess('操作成功');
    emits('submit', true);

    handleClose();
};


const handleClose = () => {
    emits('close');
};

onMounted(() => {
})
</script>

<style lang="scss" scoped></style>